const mysql = require('mysql');

//连接池
/*
let db = mysql.createConnection({
	host:"localhost",
	user:'root',
	password:'',
	database:'ws'
});
*/
//1.连接
let db = mysql.createPool({
	host:"localhost",
	user:'root',
	password:'',
	database:'ws'
});
// db.query("SQL语句",(err,data)=>{});
//2.查询
db.query('select * from user_table',(err,data)=>{
	if(err){
		console.log(err);
	}else {
		console.log(JSON.stringify(data));
	}
});